<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="user-scalable=no,width=device-width,initial-scale=1,maximum-scale=1">
    <title>评分</title>
    <link rel="stylesheet" type="text/css" href="common.css">
    <link rel="stylesheet" type="text/css" href="login.css">
    <script src="jquery-1.9.1min.js"></script>
    <style>
        .hint{
            visibility: inherit;
        }
    </style>
    <style>
        *{
            color: white;
            /*width: 25rem;*/
        }
        /* 基础样式 */
        .button-link {
            display: inline-block;
            padding: 10px 20px;
            font-size: 16px;
            text-align: center;
            text-decoration: none;
            cursor: pointer;
            border-radius: 5px;
            transition: background-color 0.3s ease;
        }

        /* 默认状态 */
        .button-link-default {
            color: #fff;
            background-color: #3498db;
            border: 2px solid #3498db;
        }

        /* 鼠标悬停状态 */
        .button-link-default:hover {
            background-color: #2980b9;
        }
        .hint {
            color: red;
        }
        .len{
            font-weight: bold;
        }
        .signin{
            color: white;
        }
        .input{
            color: #3f3d3d;
        }
    </style>
</head>
<body style="background-image: url('pingfen.jpg');background-repeat: no-repeat;width: 25rem;">
<div class="login_cont">
    <div class="login_nav">
        <div class="nav_slider">
            <a href="#" class="signin"><b>评委：</b><span id="pw"><?php echo $assessorInfo['assessor_name']?></span></a>
            <a href="#" class="signin">汇报者:<span id="hbz">待抽取</span></a>
            <span id="pep"></span>
        </div>

    </div>
    <form>
        <div class="input_signup active">
            <input type="hidden" name="func" value="score"/>
            <fieldset>
                <legend class="len">个人风采</legend>
                <label>PPT形象：</label>
                <input class="input" name="score1" type="text" id="ppt_profile" aria-label="PPT形象分数" placeholder="请输入1-100，可带一位小数的分数">
                
                <label>个人形象：</label>
                <input class="input" name="score1" type="text" id="man_profile" aria-label="个人形象分数" placeholder="请输入1-100，可带一位小数的分数">
                
                <label>演讲台风：</label>
                <input class="input" name="score1" type="text" id="speech_profile" aria-label="演讲台风分数" placeholder="请输入1-100，可带一位小数的分数">
                
            </fieldset>
            <fieldset>
                <legend class="len">目标&数据规划</legend>
                <label>目标数据呈现：</label>
                <input class="input" name="score2" type="text" id="target_data_show" aria-label="目标数据呈现分数" placeholder="请输入1-100，可带一位小数的分数">
                
            </fieldset>
            <fieldset>
                <legend class="len">目标分解任务规划</legend>
                <label>任务清单呈现：</label>
                <input class="input" name="score3" type="text" id="task_menu" aria-label="任务清单呈现分数" placeholder="请输入1-100，可带一位小数的分数">
                
            </fieldset>
            <fieldset>
                <legend class="len">目标达成路径规划</legend>
                <label>达成路径呈现：</label>
                <input class="input" name="score4" type="text" id="task_route" aria-label="目标达成路径呈现分数" placeholder="请输入1-100，可带一位小数的分数">
                
                <label>创新思维呈现：</label>
                <input class="input" name="score4" type="text" id="innovate_show" aria-label="创新思维呈现分数" placeholder="请输入1-100，可带一位小数的分数">
                
            </fieldset>
            <fieldset>
                <legend class="len">总计：</legend>
                <label>总分：</label>
                <span id="score_show"></span>
            </fieldset>
            <input type="hidden" name="user_id" id="user_id" value=""/>
            <input type="hidden" name="user_name" id="user_name" value=""/>
            <input type="hidden" name="Assessor_id" id="Assessor_id" value="<?php echo $assessorInfo['id']?>"/>
            <input type="hidden" name="Assessor_name" id="Assessor_name" value="<?php echo $assessorInfo['assessor_name']?>"/>
            <input type="button" id="submit" class="button" onclick="submitPingFen()" value="提交" style="margin: 1rem auto;">
        </div>
    </form>
    <div>
        <a class="button-link button-link-default" href="index.php?func=userscore&aid=<?php echo $assessorInfo['id']?>">打分记录</a>
        <a style="margin-left: 4.5rem;" class="button-link button-link-default" href="index.php?func=userscorelist&aid=<?php echo $assessorInfo['id']?>&aname=<?=$assessorInfo['assessor_name'];?>">遗漏打分</a>
    </div>

</div>
</body>
<script src="login.js"></script>
<!--<script src="form.js"></script>-->
<script>
    // function check(value) {
    //     var flag=/^(\d{1,2}(\.\d{1,3})?|100)(\.[0-9]{1})?$/.test(value);
    //     if (!flag){
    //
    //     }
    // }
    var proportion = "<?=$assessorInfo['first'];?>";
    $('.input').blur(function (){
        //直接显示最终分比
        var ppt_profile = parseInt($("#ppt_profile").val())?parseInt($("#ppt_profile").val()):0;
        var man_profile = parseInt($("#man_profile").val())?parseInt($("#man_profile").val()):0;
        var speech_profile = parseInt($("#speech_profile").val())?parseInt($("#speech_profile").val()):0;
        var target_data_show = parseInt($("#target_data_show").val())?parseInt($("#target_data_show").val()):0;
        var task_route = parseInt($("#task_route").val())?parseInt($("#task_route").val()):0;
        var task_menu = parseInt($("#task_menu").val())?parseInt($("#task_menu").val()):0;
        var innovate_show = parseInt($("#innovate_show").val())?parseInt($("#innovate_show").val()):0;
        ppt_profile = ppt_profile * 0.05;
        man_profile = man_profile * 0.05;
        speech_profile = speech_profile * 0.1;
        target_data_show = target_data_show * 0.2;
        task_route = task_route * 0.2;
        task_menu = task_menu * 0.2;
        innovate_show = innovate_show * 0.2;
        var sumScore = ppt_profile+man_profile+speech_profile+target_data_show+task_route+task_menu+innovate_show
        sumScore = proportion * sumScore
        $('#score_show').text(sumScore)
    })
    function submitPingFen()
    {
        var user_id = $('#user_id').val();
        var user_name = $('#user_name').val();
        var Assessor_id = $('#Assessor_id').val();
        var Assessor_name = $('#Assessor_name').val();
        var ppt_profile = $("#ppt_profile").val();
        var man_profile = $("#man_profile").val();
        var speech_profile = $("#speech_profile").val();
        var target_data_show = $("#target_data_show").val();
        var task_route = $("#task_route").val();
        var task_menu = $("#task_menu").val();
        var innovate_show = $("#innovate_show").val();

        var flag=/^(\d{1,2}(\.\d{1})?|100)$/.test(ppt_profile);
        console.log(flag)
        if (!flag){
            alert('PPT形象打分有误，请检查');
            return false;
        }
        var flag=/^(\d{1,2}(\.\d{1})?|100)$/.test(man_profile);
        if (!flag){
            alert('个人形象分数打分有误，请检查');
            return false;
        }
        var flag=/^(\d{1,2}(\.\d{1})?|100)$/.test(speech_profile);
        if (!flag){
            alert('演讲台风分数打分有误，请检查');
            return false;
        }
        var flag=/^(\d{1,2}(\.\d{1})?|100)$/.test(target_data_show);
        console.log(flag)
        if (!flag){
            alert('目标数据呈现打分有误，请检查');
            return false;
        }
        var flag=/^(\d{1,2}(\.\d{1})?|100)$/.test(task_route);
        if (!flag){
            alert('任务清单呈现分数打分有误，请检查');
            return false;
        }
        var flag=/^(\d{1,2}(\.\d{1})?|100)$/.test(task_menu);
        if (!flag){
            alert('达成路径呈现分数打分有误，请检查');
            return false;
        }
        var flag=/^(\d{1,2}(\.\d{1})?|100)$/.test(innovate_show);

        if (!flag){
            alert('创新思维呈现打分有误，请检查');
            return false;
        }
        var score = [];
        score.push(ppt_profile)
        score.push(man_profile)
        score.push(speech_profile)
        score.push(target_data_show)
        score.push(task_route)
        score.push(task_menu)
        score.push(innovate_show)

        $.ajax({url:"index.php",data:{
                'func':'score',
                'user_id' : user_id,
                'user_name' : user_name,
                'Assessor_id' : Assessor_id,
                'Assessor_name' : Assessor_name,
                'score' : score
            },dataType:'json',success:function(result){
               if (result.code == '200'){
                   alert(result.message);
                   $("#ppt_profile").val('');
                   $("#man_profile").val('');
                   $("#speech_profile").val('');
                   $("#target_data_show").val('');
                   $("#task_route").val('');
                   $("#task_menu").val('');
                   $("#innovate_show").val('');
               }else {
                   alert(result.message);
               }
            }});
    }
    setInterval(function (){
        $.ajax({url:"index.php",data:{'func':'user'},dataType:'json',success:function(result){

                $('#hbz').text(result.user_name);
                $('#user_id').val(result.user_id);
                $('#user_name').val(result.user_name);
                $('#pep').text(result.pep);
            }});
    },1000);
</script>

</html>